﻿using System;
using System.Xml.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace IcicleFramework.Renderables.Components
{
    public abstract class BaseRenderableComponent : IRenderableComponent
    {
        public virtual bool Active { get { return Parent.Visible; } }

        public IRenderable Parent { get; set; }

        public Type BaseType { get; set; }

        protected BaseRenderableComponent() {}

        protected BaseRenderableComponent(BaseRenderableComponent old)
        {
            this.Parent = old.Parent;
            this.BaseType = old.BaseType;
        }
        
        public virtual void Update(GameTime gameTime)
        {}

        public abstract IRenderableComponent DeepClone();

        public virtual void Draw(SpriteBatch spriteBatch, Vector2 position)
        {}

        public virtual void Initialize()
        {}

        public abstract void Deserialize(XElement element);
    }
}
